home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
dev
/
c
/
cxref_1_4a.lha
/
cpp
/
cexp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-25
|
52KB
|
1,902 lines
/* A Bison parser, made from cexp.y with Bison version GNU Bison version 1.22
*/
#define YYBISON 1 /* Identify Bison output. */
#define INT 258
#define CHAR 259
#define NAME 260
#define ERROR 261
#define OR 262
#define AND 263
#define EQUAL 264
#define NOTEQUAL 265
#define LEQ 266
#define GEQ 267
#define LSH 268
#define RSH 269
#define UNARY 270
#include "config.h"
#include <setjmp.h>
/* #define YYDEBUG 1 */
#ifdef MULTIBYTE_CHARS
#include <stdlib.h>
#include <locale.h>
#endif
#include <stdio.h>
typedef unsigned char U_CHAR;
/* This is used for communicating lists of keywords with cccp.c. */
struct arglist {
struct arglist *next;
U_CHAR *name;
int length;
int argno;
};
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
#ifndef GENERIC_PTR
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define GENERIC_PTR void *
#else
#define GENERIC_PTR char *
#endif
#endif
/* Find the largest host integer type and set its size and type. */
#ifndef HOST_BITS_PER_WIDE_INT
#if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
#define HOST_WIDE_INT long
#else
#define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
#define HOST_WIDE_INT int
#endif
#endif
#ifndef NULL_PTR
#define NULL_PTR ((GENERIC_PTR)0)
#endif
int yylex ();
void yyerror ();
HOST_WIDE_INT expression_value;
static jmp_buf parse_return_error;
/* Nonzero means count most punctuation as part of a name. */
static int keyword_parsing = 0;
/* Nonzero means do not evaluate this expression.
This is a count, since unevaluated expressions can nest. */
static int skip_evaluation;
/* some external tables of character types */
extern unsigned char is_idstart[], is_idchar[], is_hor_space[];
extern char *xmalloc ();
/* Flag for -pedantic. */
extern int pedantic;
/* Flag for -traditional. */
extern int traditional;
#ifndef CHAR_TYPE_SIZE
#define CHAR_TYPE_SIZE BITS_PER_UNIT
#endif
#ifndef INT_TYPE_SIZE
#define INT_TYPE_SIZE BITS_PER_WORD
#endif
#ifndef LONG_TYPE_SIZE
#define LONG_TYPE_SIZE BITS_PER_WORD
#endif
#ifndef WCHAR_TYPE_SIZE
#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
#endif
#ifndef MAX_CHAR_TYPE_SIZE
#define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE
#endif
#ifndef MAX_INT_TYPE_SIZE
#define MAX_INT_TYPE_SIZE INT_TYPE_SIZE
#endif
#ifndef MAX_LONG_TYPE_SIZE
#define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE
#endif
#ifndef MAX_WCHAR_TYPE_SIZE
#define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
#endif
/* Yield nonzero if adding two numbers with A's and B's signs can yield a
number with SUM's sign, where A, B, and SUM are all C integers. */
#define possible_sum_sign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0)
static void integer_overflow ();
static long left_shift ();
static long right_shift ();
typedef union {
struct constant {long value; int unsignedp;} integer;
struct name {U_CHAR *address; int length;} name;
struct arglist *keywords;
} YYSTYPE;
#ifndef YYLTYPE
typedef
struct yyltype
{
int timestamp;
int first_line;
int first_column;
int last_line;
int last_column;
char *text;
}
yyltype;
#define YYLTYPE yyltype
#endif
#include <stdio.h>
#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif
#define YYFINAL 77
#define YYFLAG -32768
#define YYNTBASE 34
#define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 43)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 29, 2, 31, 2, 27, 14, 2, 32,
33, 25, 23, 9, 24, 2, 26, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 8, 2, 17,
2, 18, 7, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 13, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 12, 2, 30, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
6, 10, 11, 15, 16, 19, 20, 21, 22, 28
};
#if YYDEBUG != 0
static const short yyprhs[] = { 0,
0, 2, 4, 8, 11, 14, 17, 20, 23, 24,
31, 35, 39, 43, 47, 51, 55, 59, 63, 67,
71, 75, 79, 83, 87, 91, 95, 99, 100, 105,
106, 111, 112, 113, 121, 123, 125, 127, 128, 133
};
static const short yyrhs[] = { 35,
0, 36, 0, 35, 9, 36, 0, 24, 36, 0,
29, 36, 0, 23, 36, 0, 30, 36, 0, 31,
5, 0, 0, 31, 5, 37, 32, 42, 33, 0,
32, 35, 33, 0, 36, 25, 36, 0, 36, 26,
36, 0, 36, 27, 36, 0, 36, 23, 36, 0,
36, 24, 36, 0, 36, 21, 36, 0, 36, 22,
36, 0, 36, 15, 36, 0, 36, 16, 36, 0,
36, 19, 36, 0, 36, 20, 36, 0, 36, 17,
36, 0, 36, 18, 36, 0, 36, 14, 36, 0,
36, 13, 36, 0, 36, 12, 36, 0, 0, 36,
11, 38, 36, 0, 0, 36, 10, 39, 36, 0,
0, 0, 36, 7, 40, 36, 8, 41, 36, 0,
3, 0, 4, 0, 5, 0, 0, 32, 42, 33,
42, 0, 5, 42, 0
};
#endif
#if YYDEBUG != 0
static const short yyrline[] = { 0,
176, 181, 182, 189, 194, 197, 199, 202, 206, 208,
213, 218, 230, 246, 258, 265, 272, 278, 284, 287,
290, 296, 302, 308, 314, 317, 320, 323, 326, 329,
332, 335, 337, 340, 343, 345, 347, 352, 354, 367
};
static const char * const yytname[] = { "$","error","$illegal.","INT","CHAR",
"NAME","ERROR","'?'","':'","','","OR","AND","'|'","'^'","'&'","EQUAL","NOTEQUAL",
"'<'","'>'","LEQ","GEQ","LSH","RSH","'+'","'-'","'*'","'/'","'%'","UNARY","'!'",
"'~'","'#'","'('","')'","start","exp1","exp","@1","@2","@3","@4","@5","keywords",
""
};
#endif
static const short yyr1[] = { 0,
34, 35, 35, 36, 36, 36, 36, 36, 37, 36,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
36, 36, 36, 36, 36, 36, 36, 38, 36, 39,
36, 40, 41, 36, 36, 36, 36, 42, 42, 42
};
static const short yyr2[] = { 0,
1, 1, 3, 2, 2, 2, 2, 2, 0, 6,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 0, 4, 0,
4, 0, 0, 7, 1, 1, 1, 0, 4, 2
};
static const short yydefact[] = { 0,
35, 36, 37, 0, 0, 0, 0, 0, 0, 1,
2, 6,